#include "MVDataSubSubMB.h"
#include "MVDataSubMB.h"
#include "MVDataMB.h"
#include <list>

CMVDataSubSubMB::CMVDataSubSubMB( const CMVDataSubSubMB & sub_sub_mb ) : CMVDataMBCommon( static_cast<CMVDataMBCommon>( sub_sub_mb ) )
{
	m_eLoc = sub_sub_mb.m_eLoc;
}

CMVDataSubSubMB::CMVDataSubSubMB()
{
	m_eLoc = LOC_BLOCK_MAX;
}

CMVDataSubSubMB::~CMVDataSubSubMB()
{
}

int CMVDataSubSubMB::SetLoc( LOC_BLOCK loc )
{
	m_eLoc = loc;

	return 0;
}

LOC_BLOCK CMVDataSubSubMB::GetLoc() const
{
	return m_eLoc;
}

CMVDataSubSubMB& CMVDataSubSubMB::operator = ( const CMVDataSubSubMB & sub_sub_mb )
{
	static_cast<CMVDataMBCommon>( *this ) = static_cast<CMVDataMBCommon>( sub_sub_mb );
	m_eLoc = sub_sub_mb.m_eLoc;

	return *this;
}

int CMVDataSubSubMB::CopyDataFromBlock( const CMVDataBlock * block )
{
	if ( block->GetShape() != SHAPE_BLOCK_SUB_SUB_MB )
	{
		return -1;
	}

	// TODO 优化拷贝
	if( block->HaveASAD() ) SetASAD( block->GetASAD() );
	if( block->HaveSADBitCount() ) SetSADBitCount( block->GetSADBitCount() );
	if( block->HaveMVCoordinate() ) SetMVCoordinate( block->GetMVCoordinateX(), block->GetMVCoordinateY() );

	m_eLoc = block->GetSecondLayerLoc();

	return 0;
}